package com.consumer1.cos;

import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.region.Region;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version v1.0
 * @author: TianXiang
 * @description: 腾讯云-
 * @date: 2021/3/22
 */
@Configuration
public class COSConfig {

    @Value("${cos.secretId}")
    private String secretId;

    @Value("${cos.secretKey}")
    private String secretKey;

    @Value("${cos.bucketRegion}")
    private String bucketRegion;

    @Bean
    public COSClient initClient() {
        return new COSClient(new BasicCOSCredentials(secretId, secretKey), new ClientConfig(new Region(bucketRegion)));
    }

}
